home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 11 / AMUG BBS in a Box Volume XI (April 1994) (MacWizards).iso / Files / Tele / D-F / DIALSC16.sit / DialScript 1.6 / Examples / cs.ds < prev    next >
Encoding:
Text File  |  1991-10-04  |  2.5 KB  |  82 lines  |  [TEXT/dIsR]

  1. -- UTexas CS Dept. 2400 Baud login script.
  2.  
  3. -- A complicated example.
  4.  
  5. -- To use 1200, remove the "send break". And set speed to 1200
  6.  
  7. -- The script tries to get the modem's attention and dial, even if it has
  8. -- to hang up to do it.  It uses timeouts to recover from problems.
  9. -- Problems after connect are assumed to be due to line noise, so it
  10. -- hangs up and dials again in hope of a cleaner line.
  11.  
  12. -- You need to set the variable for your username in state init.
  13.  
  14. script cs
  15.  
  16.    state init
  17.       set port modem; -- These sets are not needed.
  18.       set speed 2400; -- The values are the defaults.
  19.       set databits 8; -- And better to use settings file
  20.  
  21.       setvar USERNAME "newton";  -- We get this now, so user can walk away.
  22.       input PASSWORD;            -- You could hardwire this also.
  23.  
  24.       display "Beginning UT CS login script...";
  25.       next ModemReady;
  26.    end; -- init
  27.  
  28.    state ModemReady            -- Be sure we have modem's attention
  29.       send "\r"; send "AT\r";
  30.       select
  31.          "OK"      : next Dial;
  32.          timeout 3 :
  33.       end;
  34.       send "\r"; send "AT\r"; -- try again
  35.       select
  36.          "OK"      : next Dial;
  37.          timeout 3 : next HangUp;  -- failed again, maybe hangup
  38.       end;
  39.    end; -- ModemReady
  40.  
  41.    state HangUp              -- Hang up a Hayes modem
  42.       send ""; send "+++";   -- First send is for a delay
  43.       select
  44.         "OK"      : send "ATH\r"; next ModemReady;
  45.         timeout 3 :
  46.       end;
  47.       send ""; send "+++";  -- try again
  48.       select
  49.          "OK"      : send "ATH\r"; next ModemReady;
  50.          timeout 3 : display "Hangup timeout";
  51.       end;
  52.       send "\r"; send "ATH\r";  -- Maybe we are talking to modem somehow
  53.       next ModemReady;
  54.    end; -- HangUp
  55.  
  56.    state Dial
  57.       send "ATDT4718454\r";     -- The system's phone number
  58.       select
  59.          "CONNECT"      : next GotIt;
  60.          "BUSY"         : next ModemReady;
  61.          "NO CARRIER"   : next ModemReady;
  62.          timeout 22     : display "Dial timeout!"; next ModemReady;
  63.       end; 
  64.    end; -- Dial
  65.  
  66.    state GotIt
  67.       delay 1;
  68.       send break;   -- UNIX host needs a break to switch to 2400 baud
  69.       select 
  70.          "login:"     :
  71.          timeout 60   : display "login timeout!"; next HangUp;
  72.       end;
  73.       send USERNAME; send "\r";             -- Your username and return
  74.       select
  75.          "Password:" :
  76.          timeout 60  : display "password timeout!"; next HangUp;
  77.       end;
  78.       send PASSWORD; send "\r";            -- Your password and return
  79.    end; -- GotIt
  80.  
  81. end; -- UTlogin
  82.